<template>
  <div class="store-home">
    <search-bar></search-bar>
    <scroll :top="scrollTop" @onScroll="onScroll" ref="scroll">
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
      <div class="">HelloVue</div>
    </scroll>
  </div>
</template>

<script>
import SearchBar from '@/components/home/SearchBar'
import Scroll from '@/components/common/Scroll'
import { storeHomeMixin } from '@/utils/mixin.js'

export default {
  mixins: [storeHomeMixin],
  components: {
    SearchBar,
    Scroll
  },
  data () {
    return {
      scrollTop: 94
    }
  },
  methods: {
    onScroll (offsetY) {
      this.setOffsetY(offsetY)
      if (offsetY > 0) {
        this.scrollTop = 52
      } else {
        this.scrollTop = 94
      }
      this.$refs.scroll.refresh()
    }
  }
}
</script>

<style  lang="scss" scoped rel="stylesheet/scss">
@import "../../assets/styles/global";
.store-home {
  width: 100%;
  height: 100%;
}
</style>
